package com.fujifilm.project.plan.config;

import org.springframework.context.annotation.Configuration;

import com.mybatisflex.core.audit.AuditManager;

import lombok.extern.slf4j.Slf4j;

@Configuration
@Slf4j
public class MyBatisFlexConfiguration {
    public MyBatisFlexConfiguration() {
        // 开启审计功能
        AuditManager.setAuditEnable(true);

        // 设置 SQL 审计收集器
        AuditManager.setMessageCollector(
                auditMessage -> log.info("{}, --> exec token {}ms", auditMessage.getFullSql(),
                        auditMessage.getElapsedTime()));
    }
}
